<extend name="Public/base"/>

<block name="body">
    <div class="am-cf am-u-md-12 header-title">
        <h2>{$info['id']?'编辑':'新增'}配置</h2>
    </div>

    <div class="am-cf am-u-md-12">
        <form action="{:U()}" method="post" class="am-form am-form-horizontal">
            <div class="am-form-group">
                <label class="am-u-sm-2 am-form-label">配置标识</label>
                <div class="am-u-sm-10">
                    <input type="text" class="text input-large am-form-field" style="width: 400px" name="name" value="{$info.name|default=''}">
                    <span class="am-form-help">（用于C函数调用，只能使用英文且不能重复）</span>
                </div>
            </div>
            <div class="am-form-group">
                <label class="am-u-sm-2 am-form-label">配置标题</label>
                <div class="am-u-sm-10">
                    <input type="text" class="text input-large am-form-field" style="width:400px;" name="title" value="{$info.title|default=''}">
                    <span class="am-form-help">（用于后台显示的配置标题）</span>
                </div>
            </div>
            <div class="am-form-group">
                <label class="am-u-sm-2 am-form-label">排序</label>
                <div class="am-u-sm-10">
                    <input type="text" class="text input-small am-form-field" style="width: 400px" name="sort" value="{$info.sort|default=0}">
                    <span class="am-form-help">（用于分组显示的顺序）</span>
                </div>
            </div>
            <div class="am-form-group">
                <label class="am-u-sm-2 am-form-label">配置类型</label>
                <div class="am-u-sm-10">
                    <select name="type" class="am-form-field" style="width:auto;">
                        <volist name="Think.config.CONFIG_TYPE_LIST" id="type">
                            <option value="{$key}">{$type}</option>
                        </volist>
                    </select>
                    <span class="am-form-help">（系统会根据不同类型解析配置值）</span>
                </div>
            </div>
            <div class="am-form-group">
                <label class="am-u-sm-2 am-form-label">配置分组</label>
                <div class="am-u-sm-10">
                    <select name="group" class="am-form-field" style="width: auto">
                        <option value="0">不分组</option>
                        <volist name="Think.config.CONFIG_GROUP_LIST" id="group">
                            <option value="{$key}">{$group}</option>
                        </volist>
                    </select>
                    <span class="am-form-help">（配置分组 用于批量设置 不分组则不会显示在系统设置中）</span>
                </div>
            </div>
            <div class="am-form-group">
                <label class="am-u-sm-2 am-form-label">配置值</label>
                <div class="am-u-sm-10">
                    <label class="textarea input-large">
                        <textarea name="value" class="am-form-field" style="width: 400px;height: 200px">{$info.value|default=''}</textarea>
                    </label>
                    <span class="am-form-help">（配置值）</span>
                </div>
            </div>
            <div class="am-form-group">
                <label class="am-u-sm-2 am-form-label">配置项</label>
                <div class="am-u-sm-10">
                    <label class="textarea input-large">
                        <textarea name="extra" class="am-form-field" style="width: 400px;height: 200px">{$info.extra|default=''}</textarea>
                    </label>
                    <span class="am-form-help">（如果是枚举型 需要配置该项）</span>
                </div>
            </div>
            <div class="am-form-group">
                <label class="am-u-sm-2 am-form-label">说明</label>
                <div class="am-u-sm-10">
                    <label class="textarea input-large">
                        <textarea name="remark" class="am-form-field" style="width: 400px;height: 200px">{$info.remark|default=''}</textarea>
                    </label>
                    <span class="am-form-help">（配置详细说明）</span>
                </div>
            </div>
            <div class="am-form-group">
                <div class="am-u-sm-10 am-u-sm-offset-2">
                    <input type="hidden" name="id" value="{$info.id|default=''}">
                    <button class="am-btn submit-btn ajax-post" id="submit" type="submit" target-form="form-horizontal">确 定</button>
                    <button class="am-btn btn-return" onclick="javascript:history.back(-1);return false;">返 回</button>
                </div>
            </div>
        </form>
    </div>

</block>

<block name="script">
	<script type="text/javascript">
		Think.setValue("type", {$info.type|default=0});
		Think.setValue("group", {$info.group|default=0});
		//导航高亮
		highlight_subnav('{:U('Config/index')}');
	</script>
</block>
